Skip to content

Add custom math example#133

Open
sstroemer wants to merge 3 commits intoait-energy:mainfrom
sstroemer:add-example-60
Open

Add custom math example#133
sstroemer wants to merge 3 commits intoait-energy:mainfrom
sstroemer:add-example-60

Conversation

@sstroemer
Copy link
Copy Markdown
Member

Copilot summary below.


This pull request introduces a new example demonstrating how to extend the optimization framework with custom mathematical logic using an addon. It adds a configuration and a Julia addon file that defines custom variables and constraints, and includes a corresponding test to validate the behavior.

New example and custom addon integration:

  • Added a new example configuration file (60_custom_math.iesopt.yaml) that sets up an optimization problem using a custom math addon and defines relevant carriers, nodes, and profiles.
  • Implemented a new Julia addon (CustomMath.jl) that demonstrates how to define custom variables and constraints, including linking new variables to existing components and modifying expressions within the optimization model.

Testing:

  • Added a test case to verify the correct integration and behavior of the custom math addon, ensuring the model variables and outputs match expected values.

@sstroemer sstroemer marked this pull request as ready for review December 19, 2025 11:29
@sstroemer
Copy link
Copy Markdown
Member Author

Not sure why I can't run the skipped CI anymore (see https://github.com/ait-energy/IESopt.jl/actions/runs/20368684396; probably something that changed in #129). I've just opened #134 for that, but I think for this one here it's still fine to merge: tests are passing locally on my PC and it's "just" an example with a test, no actual changes.

@petrareisz
Copy link
Copy Markdown

It is a great simple example which provides a template to build the "conversion pathway" between nodes.

Building on this, I constructed the modified version of this same model, where the conversion efficiency gas -> electricity is given by a piecewise linear function. The underlying efficiency is a typical one of a combined heat and power unit.

Copy link
Copy Markdown

@petrareisz petrareisz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, simple, working example which represents adding conversion rules between nodes as affine expressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants